package com.wyj.api.impl;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import com.wyj.api.UserApi;
import com.wyj.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;

/**
 * TODO: 用户API
 *
 * @author wuyijie
 * @date 2022/1/14 9:08 PM
 */
@DubboService(interfaceClass = UserApi.class, version = "${dubbo.service.user.version}")
@Slf4j
public class UserApiImpl implements UserApi {
    @NacosValue(value = "{user.name}", autoRefreshed = true)
    private String name;

    /**
     * TODO: methodA
     *
     * @return com.wyj.entity.User
     * @author wuyijie
     * @date 2022/1/14 9:04 PM
     */
    @Override
    public User methodA() {
        try {
            Thread.sleep(50);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return new User("1", name);
    }

    /**
     * TODO: methodB
     *
     * @return com.wyj.entity.User
     * @author wuyijie
     * @date 2022/1/14 9:05 PM
     */
    @Override
    public User methodB() {
        try {
            Thread.sleep(70);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return new User("2", "b");
    }

    /**
     * TODO: methodC
     *
     * @return com.wyj.entity.User
     * @author wuyijie
     * @date 2022/1/14 9:05 PM
     */
    @Override
    public User methodC() {
        try {
            Thread.sleep(90);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return new User("3", "c");
    }
}
